import { NextResponse } from "next/server"; import { listMonths } from "@/lib/storage"; export async function GET(request, ctx) { const { branch, year } = await ctx.params; console.log("[/api/branches/[branch]/[year]/months] params:", { branch, year, }); if (!branch || !year) { return NextResponse.json( { error: "branch oder year fehlt" }, { status: 400 } ); } try { const months = await listMonths(branch, year); return NextResponse.json({ branch, year, months }); } catch (error) { console.error("[/api/branches/[branch]/[year]/months] Fehler:", error); return NextResponse.json( { error: "Fehler beim Lesen der Monate: " + error.message }, { status: 500 } ); } }